package com.test.flink_source;

import com.google.common.collect.Lists;
import com.test.beans.UserBean;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;
import java.util.List;

public class F03Collection {

    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration();
        configuration.setInteger("rest.port", 8888);
        StreamExecutionEnvironment webUI = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(configuration);

        List<UserBean> list = Lists.newArrayList(
                UserBean.of(1, "zs1", 18, "SH", 11L),
                UserBean.of(1, "zs1", 18, "SH", 11L),
                UserBean.of(1, "zs1", 18, "SH", 11L),
                UserBean.of(1, "zs1", 18, "SH", 11L),
                UserBean.of(1, "zs1", 18, "SH", 11L));
        DataStreamSource<UserBean> data = webUI.fromCollection(list);

        data.print();
        webUI.execute();
    }
}
